- page_title milestone.title, "里程碑"

- group = local_assigns[:group]

.detail-page-header
  .status-box{ class: "status-box-#{milestone.closed? ? 'closed' : 'open'}" }
    - if milestone.closed?
      已关闭
    - elsif milestone.expired?
      已过期
    - else
      未关闭
  %span.identifier
    里程碑 #{milestone.title}
  - if milestone.expires_at
    %span.creator
      &middot;
      = milestone.expires_at
  - if group
    .pull-right
      - if can?(current_user, :admin_milestones, group)
        - if milestone.active?
          = link_to '关闭里程碑', group_milestone_path(group, milestone.safe_title, title: milestone.title, milestone: {state_event: :close }), method: :put, class: "btn btn-grouped btn-close"
        - else
          = link_to '重新打开里程碑', group_milestone_path(group, milestone.safe_title, title: milestone.title, milestone: {state_event: :activate }), method: :put, class: "btn btn-grouped btn-reopen"

.detail-page-description.milestone-detail
  %h2.title
    = markdown escape_once(milestone.title), pipeline: :single_line

- if milestone.complete?(current_user) && milestone.active?
  .alert.alert-success.prepend-top-default
    - close_msg = group ? '可以关闭此里程碑。' : '导航到此项目去关闭此里程碑。'
    %span 该里程碑的全部问题都已关闭。#{close_msg}

.table-holder
  %table.table
    %thead
      %tr
        %th 项目
        %th 未关闭问题
        %th 状态
        %th 到期日
    - milestone.milestones.each do |ms|
      %tr
        %td
          - project_name = group ? ms.project.name : ms.project.name_with_namespace
          = link_to project_name, namespace_project_milestone_path(ms.project.namespace, ms.project, ms)
        %td
          = ms.issues_visible_to_user(current_user).opened.count
        %td
          - if ms.closed?
            已关闭
          - else
            未关闭
        %td
          = ms.expires_at

